package com.ogawa.base.utils;

import android.content.Context;
import android.view.ViewGroup;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;


public class AutoHeightLinearLayoutManager extends LinearLayoutManager {
    public AutoHeightLinearLayoutManager(Context context) {
        super(context);
    }

    @Override
    public RecyclerView.LayoutParams generateLayoutParams(ViewGroup.LayoutParams lp) {
//        try{
//            int height = getHeight()/getChildCount();
//            lp.height = height;
//            return new RecyclerView.LayoutParams(height,
//                    ViewGroup.LayoutParams.WRAP_CONTENT);
//        }catch (Exception e){
//            e.printStackTrace();
//        }
////        return super.generateLayoutParams(lp);
//        return new RecyclerView.LayoutParams(
//                ViewGroup.LayoutParams.WRAP_CONTENT,
//                ViewGroup.LayoutParams.WRAP_CONTENT);
        return new RecyclerView.LayoutParams(30,30);
    }
}
